/*
 * Description:  Guest Manager
 */
#ifndef GUESTMANAGER_H
#define GUESTMANAGER_H
#include "sendto_host.h"
#include <windows.h>
#include <iostream>
#include <tchar.h>
#include <vector>
#include <winternl.h>
#include <cstdio>

#pragma comment(lib, "ntdll.lib")

#define SystemModuleInformation 11

typedef struct _SYSTEM_MODULE {
    PVOID  Reserved1;
    PVOID  Reserved2;
    PVOID  ImageBase;
    ULONG  ImageSize;
    ULONG  Flags;
    WORD   Id;
    WORD   Rank;
    WORD   LoadCount;
    WORD   NameOffset;
    CHAR   Name[256];
} SYSTEM_MODULE, * PSYSTEM_MODULE;

typedef struct _SYSTEM_MODULE_INFORMATION {
    ULONG         ModulesCount;
    SYSTEM_MODULE Modules[1];
} SYSTEM_MODULE_INFORMATION, * PSYSTEM_MODULE_INFORMATION;

typedef NTSTATUS(NTAPI* NtQuerySystemInformation_t)(
    ULONG SystemInformationClass,
    PVOID SystemInformation,
    ULONG SystemInformationLength,
    PULONG ReturnLength
    );
using namespace std;
namespace COMMON {
class GuestManager {
public:
    /********************
    * 函数：GetSendToHost
    * 功能：获取m_sendtoHost
    * 返回：m_sendtoHost
    ********************/
    std::shared_ptr<WINCONTROL::SendToHost> GetSendToHost();
    /********************
    * 函数：SetSendToHost
    * 功能：设置m_sendtoHost
    * 返回：NA
    ********************/
    void SetSendToHost(std::shared_ptr<WINCONTROL::SendToHost> m_sendtoHost);
    /********************
    * 函数：LogProductName
    * 功能：获取交付件版本
    * 返回：NA
    ********************/
    void LogProductName(const wchar_t* PRODUCTS[]);
    /********************
    * 函数：LogDriverInfo
    * 功能：记录驱动信息
    * 返回：int
    ********************/
    int LogDriverInfo();

private:
    std::shared_ptr<WINCONTROL::SendToHost> m_sendtoHost = nullptr;
};
#define GUEST_MANAGER SingletonNew<COMMON::GuestManager>::GetInstance()
}
#endif